package Guigu7;
/*
 * 总结：属性赋值的先后顺序
 * 
 * ① 默认初始化
 * ② 显示初始化
 * ③ 构造器赋值
 * ④ 通过“对象.方法”或“对象.属性”的方式赋值。
 * 
 * 
 * 以上操作的先后顺序：①>>>②>>>③>>>④
 * 
 */
public class PersonTest {

	public static void main(String[] args) {
		 //②
		Person p = new Person("sh",78);
		p.setAge(15);
		//③
		Person p1 = new Person(6);
		//④
		p1.setAge(8);
		
		System.out.println(p1.age);
	}

}

class Person
{
	String name;
	int age=7;
	
	public Person()
	{
		
	}
	
	public Person(int a)
	{
		age = a;
	}
	
	public void setAge(int a)
	{
		age = a;
	}

	public Person(String name, int age) {
		super();
		this.name = name;
		this.age = age;
	}
	
}
